<template>
  <div :class="$route.query.spaceKey ? 'padding-left-right-40 padding-top-bottom-20' : 'padding-left-20'">
    <el-tabs v-model="activeName" @tab-click="tabClick">
      <el-tab-pane label="楼宇信息" name="info">
        <building-info ref="info" :spaceKey="spaceKey"></building-info>
      </el-tab-pane>
      <el-tab-pane label="楼层规划" name="programme">
        <building-programme ref="programme" :spaceKey="spaceKey"></building-programme>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script>
  import buildingInfo from './buildInfo';
  import buildingProgramme from './building';
  export default {
    components: { buildingInfo, buildingProgramme },

    props: {
      spaceKey: {
        type: String,
        default: '',
      },
    },

    data() {
      return {
        activeName: 'info',
      };
    },

    mounted() {
    },

    methods: {
      tabClick() {
        setTimeout(() => {
          this.init();
        }, 0);
      },

      init() {
        this.$refs[this.activeName].init && this.$refs[this.activeName].init();
      },
    },
  };
</script>
<style lang="scss" scoped>
  .tabs-box {
    padding: 10px 20px 0 20px;
    width: 100%;
  }
</style>
